﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Net.Mail;

using System.Web.Services;
using AjaxControlToolkit;
using System.IO.MemoryMappedFiles;


public partial class partner_partner_update_agent : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Response.Redirect("sessiont.aspx");
        }


        int s = 0;
        Label1.Text = s.ToString();
        Label2.Text = Session["email"].ToString();



        SqlConnection conn = null;
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn.Open();
        SqlCommand scmd = new SqlCommand("SELECT * FROM agent_add where a_id='" + Session["a_id"] + "'", conn);

        SqlDataReader dr = scmd.ExecuteReader();
        if (dr.Read())
        {

            //Label1.Visible = true;
            txtfname1.Text = dr[2].ToString();
            txtmname.Text = dr[3].ToString();
            txtlname1.Text = dr[4].ToString();
            txtdob1.Text = dr[5].ToString();
            txtoccupation.Text = dr[6].ToString();
            txthno.Text = dr[7].ToString();
            txtcity.Text = dr[8].ToString();
            txtstreet.Text = dr[9].ToString();
            txtssn.Text = dr[10].ToString();
            txtzip.Text = dr[11].ToString();
            txtcountry.Text = dr[12].ToString();
            txtemail.Text = dr[13].ToString();
            txtpass.Text = dr[14].ToString();


            Label5.Text = Session["a_id"].ToString();


        }


        dr.Close();
   

    }
    protected void Save_Click(object sender, EventArgs e)
    {
        SqlConnection conn = null;
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn.Open();

        //SqlCommand cm1 = new SqlCommand("UPDATE agent_add set f_name='" + txtfname1.Text + "', m_name='" + txtmname.Text + "',l_name ='" + txtlname1.Text + "', d_o_b='" + txtdob1.Text + "',occu='" + txtoccupation.Text + "',h_no='" + txthno.Text + "',city='" + txtcity.Text + "', street='" + txtstreet.Text + "',ssn='" + txtssn.Text + "', zip_code='" + txtzip.Text + "',country='" + txtcountry.Text + "',email='" + txtemail.Text + "',pass='" + txtpass.Text + "',type='" + txtpass.Text + "' where a_id='" + Session["a_id"]+ "'", conn);
        //cm1.ExecuteNonQuery();

        SqlCommand cm1 = new SqlCommand("update agent_add set f_name='" + txtfname1.Text + "' where a_id='" +Session ["a_id"] + "'", conn);
        cm1.ExecuteNonQuery();
        //Label1.Text=Session ["a_id"].ToString ();
        Response.Redirect("partner_update_agent_conf.aspx");
        conn.Close();

    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        }
    protected void LinkButton1_Click(object sender, System.EventArgs e)
    {
        Session.Abandon();
        Response.Redirect("../partner.aspx");
    }
}